#!/usr/bin/bash
#bash ./xxx.sh   avoid shebang

#开发思路：1、打开微信的自动下载功能
#        2、去自动下载文件的里
#       3、通过awk判断所有的文件是否大于启动脚本时的日期
#        4、mail新文件到某人邮箱


function cdDir(){
        # if( -f cdDir.log)
        # touch cdDir.log
        pathDir=$(find /d/develop-data -type d -name wxid_hcvtce8zgbc512 2>>cdDir.log)
        echo "$pathDir"
        cd "$pathDir"
        cd ./FileStorage/File/2020-09;ls -l
}
function judgeNewFile(){

        #read -p "这个文件以什么开头？" fileHead
        #ls -l |grep /^xx以什么开头的文件${fileHead}xx |awk 'BEGIN{}  {if($8>"23:00||$8<"6:00"){mailxxxxxx调用mail函数或自己完成xxxxxx }}  END{}'
        ls -l |awk 'BEGIN{}  {if($8>"21:00"||$8<"06:00"){print $0,$8,"mailxxxxxx调用mail函数或自己完成xxxxxx" }}  END{}'
}
function mailTo(){

        #qq邮箱的smtp服务器地址是smtp.qq.com。其他邮箱服务器地址请看：https://cloud.tencent.com/developer/article/1147401
#         winpty Send-MailMessage   -Subject "test powershell mail"       `
# -From  "qingchen.shen@foxmail.com"   -To  "249541803@qq.com"   `
# -SmtpServer   "smtp.qq.com"  -Port 25  -UseSsl    -Credential  "qingchen.shen@foxmail.com"  `
# -body "1111111111111111" `
#-Attachments $附件 -BodyAsHTML -body $HTML邮件内容

winpty Send-MailMessage   -Subject "test powershell mail"   -From  "qingchen.shen@foxmail.com"   -To  "249541803@qq.com"   -SmtpServer   "smtp.qq.com"  -Port 25  -UseSsl    -Credential  "qingchen.shen@foxmail.com"  -body "1111111111111111" 




}

# cdDir
# judgeNewFile
mailTo
